<template>
  <div>
    <p v-if="!proName">loading...</p>
    <p v-else>最受欢迎的是
      <a :href="proUrl">{{proName}}</a>
    </p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      proName: '',
      proUrl: ''
    }
  },
  mounted() {
    axios.get('/api/repositories/vue').then(
      response => {
        const result = response.data
        const {name, html_url} = result.data
        // console.log(result);
        this.proName = name
        this.proUrl = html_url
      },
      errer => {
        alert('请求失败')
      }
    )
  }
}
</script>

<style scoped>
</style>